package com.gax.controller;

import com.gax.service.HeadlineService;
import com.gax.service.TypeService;
import com.gax.utils.Result;
import com.gax.vo.PortalVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author GAX
 * @date 2025-06-16
 */

@RestController
@RequestMapping("portal")
@CrossOrigin
public class PortalController {

    @Autowired
    private TypeService typeService;

    @Autowired
    private HeadlineService headlineService;

    @GetMapping("findAllTypes")
    public Result findAllTypes() {
        Result allTypes = typeService.findAllTypes();
        return allTypes;
    }

    @PostMapping("findNewsPage")
    public Result findNewsPage(@RequestBody PortalVo portalVo) {
        Result pageInfo = headlineService.findNewsPage(portalVo);
        return pageInfo;
    }

    @PostMapping("showHeadlineDetail")
    public Result showHeadlineDetail(Integer hid) {
        Result result = headlineService.showHeadlineDetail(hid);
        return result;
    }

}
